<template>
  <div>
    <el-row>
      <el-col :span="16" style="width:100%;">
        <div class="num">
          <el-card
            v-for="item in CountData"
            :key="item.id"
            :body-style="{ display: 'flex', padding: 0 }"
            shadow="hover"
            @click.native="openNewWin(item)" :style="{ backgroundColor: item.txtColor }"
          >
            <i
              class="icon"
              :class="`el-icon-${item.icon}`"
              :style="{ backgroundColor: item.labelColor }"
            ></i>
            <div class="details">
              <p class="desc">{{ item.name }}</p>
            </div>
          </el-card>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>

const { ipcRenderer } = window.require("electron");

export default {
  data() {
    return {
      CountData: [
        {
          id: 1,
          name: "URL编码",
          value: 1234,
          icon: "lock",
          labelColor: "#2ec7c9",
          txtColor: "silver",
          path: "/encrypt/UrlEncode",
          windowTitle: "UrlEncode编码"
        }
      ],
    };
  },
  methods:{
    openNewWin(item){
        //触发事件名
        ipcRenderer.send("openWindow", {
          "windowTitle": item.windowTitle,
          "path" : item.path
        });
    }
  }
};
</script>

<style lang="less" scoped>
.num {
  display: flex;
  // 要换行
  flex-wrap: wrap;
  // 从头到尾均匀排列
  justify-content: space-between;
  margin-left: 20px;
  .el-card {
    width: 23%;
    margin-bottom: 20px;

    .icon {
      width: 80px;
      height: 80px;
      line-height: 80px;
      text-align: center;
      font-size: 30px;
      color: #fff;
    }

    .details {
      // 竖着排且居中
      display: flex;
      flex-direction: column;
      justify-content: center;

      margin-left: 15px;

      .price {
        font-size: 30px;
        margin-bottom: 10px;
        line-height: 30px;
        height: 30px;
      }

      .desc {
        font-size: 14px;
        color: rgb(42, 3, 3);
        text-align: center;
      }
    }
  }
}
</style>